home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / admin / snmp-dev.000 / snmp-dev / asn1.h next >
Encoding:
C/C++ Source or Header  |  1995-07-09  |  2.6 KB  |  88 lines

  1. /*
  2.  * Definitions for Abstract Syntax Notation One, ASN.1
  3.  * As defined in ISO/IS 8824 and ISO/IS 8825
  4.  *
  5.  *
  6.  */
  7. /***********************************************************
  8.     Copyright 1988, 1989 by Carnegie Mellon University
  9.  
  10.                       All Rights Reserved
  11.  
  12. Permission to use, copy, modify, and distribute this software and its 
  13. documentation for any purpose and without fee is hereby granted, 
  14. provided that the above copyright notice appear in all copies and that
  15. both that copyright notice and this permission notice appear in 
  16. supporting documentation, and that the name of CMU not be
  17. used in advertising or publicity pertaining to distribution of the
  18. software without specific, written prior permission.  
  19.  
  20. CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  21. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  22. CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  23. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  24. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  25. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  26. SOFTWARE.
  27. ******************************************************************/
  28.  
  29. #ifndef EIGHTBIT_SUBIDS
  30. typedef u_long    oid;
  31. #define MAX_SUBID   0xFFFFFFFF
  32. #else
  33. typedef u_char    oid;
  34. #define MAX_SUBID   0xFF
  35. #endif
  36.  
  37. #define MAX_OID_LEN        64    /* max subid's in an oid */
  38.  
  39. #define ASN_BOOLEAN        (0x01)
  40. #define ASN_INTEGER        (0x02)
  41. #define ASN_BIT_STR        (0x03)
  42. #define ASN_OCTET_STR        (0x04)
  43. #define ASN_NULL        (0x05)
  44. #define ASN_OBJECT_ID        (0x06)
  45. #define ASN_SEQUENCE        (0x10)
  46. #define ASN_SET            (0x11)
  47.  
  48. #define ASN_UNIVERSAL        (0x00)
  49. #define ASN_APPLICATION     (0x40)
  50. #define ASN_CONTEXT        (0x80)
  51. #define ASN_PRIVATE        (0xC0)
  52.  
  53. #define ASN_PRIMITIVE        (0x00)
  54. #define ASN_CONSTRUCTOR        (0x20)
  55.  
  56. #define ASN_LONG_LEN        (0x80)
  57. #define ASN_EXTENSION_ID    (0x1F)
  58. #define ASN_BIT8        (0x80)
  59.  
  60. #define IS_CONSTRUCTOR(byte)    ((byte) & ASN_CONSTRUCTOR)
  61. #define IS_EXTENSION_ID(byte)    (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  62.  
  63. u_char    *asn_parse_int();
  64. u_char    *asn_build_int();
  65. u_char    *asn_parse_unsigned_int();
  66. u_char    *asn_build_unsigned_int();
  67. u_char    *asn_parse_string();
  68. u_char    *asn_build_string();
  69. u_char    *asn_parse_header();
  70. u_char    *asn_build_header();
  71. u_char    *asn_build_sequence();
  72. u_char    *asn_parse_length();
  73. u_char    *asn_build_length();
  74. u_char    *asn_parse_objid();
  75. u_char    *asn_build_objid();
  76. u_char    *asn_parse_null();
  77. u_char    *asn_build_null();
  78. u_char    *asn_parse_bitstring();
  79. u_char    *asn_build_bitstring();
  80. u_char    *asn_parse_unsigned_int64();
  81. u_char    *asn_build_unsigned_int64();
  82.  
  83. struct counter64 {
  84.     u_long high;
  85.     u_long low;
  86. };
  87.  
  88.